package iO;

import java.io.*;
import java.util.Scanner;

/**
 * @Author: Miyako
 * @Date: 2024-07-17-11:34
 * @Description:
 */
public class PrintWriteDemo02 {

    public static void main(String[] args) throws IOException {
        FileWriter fw = new FileWriter("note5.txt");
        fw.write("hello");
        fw.flush();
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream("note1.txt"))));
        String sc1 = "";
        System.out.print("输入>");
        while (!("exit").equalsIgnoreCase(sc1 = sc.next())){
            System.out.print("继续输入\n输入exit退出\n输入save保存内容>");
            if ("save".equalsIgnoreCase(sc1))
                pw.flush();
            pw.println(sc1);
        }
        pw.close();
        sc.close();
    }
}
